package com.xm.common.service;

import com.alibaba.fastjson2.JSON;
import com.xm.common.entity.RuntimeDetail;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.kafka.core.KafkaTemplate;
import org.springframework.stereotype.Service;

@Service
public class KafkaProducerService {

    private static final String TOPIC = "monitor";

    @Autowired
    private KafkaTemplate<String, String> kafkaTemplate;

    public void sendDataDetails(RuntimeDetail data) {
        kafkaTemplate.send(TOPIC, JSON.toJSONString(data));
    }
}


